Miniapp initialization
AppBoxoWebAppInit
An event to notify host app about miniapp’s initialization
AppBoxoWebAppGetInitData
Gets init data from host app
Returns an object with:
app_idMiniapp IDclient_idHost client IDpayloadString consisting of encrypted user detailsdata {[key: string]: any}null custom data passed from Hostapptokenoptional User session token if it is still active
TIP There is a shortcut
.getInitData() that handles saving details above in cookies or localStorage and returns a Promise. Miniapp manipulation
AppBoxoWebAppOpenMiniApp
Opens other miniapp based on provided application ID
Parameters
app_idrequired Miniapp ID to open
AppBoxoWebAppCloseMiniApp
Close current active miniapp
AppBoxoWebAppOnRestore
Event that is fired when miniapp is restored.
Example:
Authentication
AppBoxoWebAppLogin
Login user using credentials given from host app
Example:
TIP There is a shortcut that you can use:
AppBoxoWebAppLogout
Logout and clear session token
Example:
TIP There is a shortcut that you can use:
AppBoxoWebAppClearToken
Clears saved token in host app
AppBoxoWebAppSaveToken
Saves provided token in host app
Parameters
tokenrequired Token to save in host app
Appboxo Pay
AppBoxoWebAppPay
Send payment event to host app
orderPaymentId:string, amount: number, orderId: string, currency: string, extraParams?: any
Parameters
orderPaymentIdrequiredstringOrder payment identifierminiappOrderIdrequirednumberUnique identifier for the current paymentamountrequiredbooleanPayment amountcurrencyrequiredstringDefine currency codeextraParams:anyAny extra data
orderPaymentId:stringOrder payment identifierminiappOrderId:numberUnique identifier for the current paymenthostappOrderId:numberUnique identifier from hostappamount:booleanPayment amountcurrency:stringDefine currency codestatus:stringStatus of the paymentextraParams:anyAny extra data
Tab bar
AppBoxoWebAppSetTabBar
Initialized native tab bar component
Parameters
showrequiredbooleanDefines TabBar visibilityactiveTabrequirednumberActive TabBar item idlistrequiredArray<{ tabId: number, tabName: string, tabIcon: string }> Define tabsoptionsrequired{ color: string, background: string, selectedColor: string, hasBorder: boolean, borderColor: string }Tab bar optionsbadgesoptionalArray<{ tabId: number, background: string, color: string, value?: string }>Define tab item badges.
AppBoxoWebAppTabBarItemClick
Event that should be subscribed to in order to get active tab item click
Example:
Navigation bar
AppBoxoWebAppSetNavigationBar
Activates native navigation bar.
Example:
Action buttons
AppBoxoWebAppSetActionButton
Changes actions button theme. By default it is dark.
Example:
Loading indicator
AppBoxoWebAppLoadingIndicator
Show native loading indicator.
Important: Loading indicator will timeout after 30 seconds with prompt to hide it if no event is dispatched to change it.
Example:
QR code reader
AppBoxoWebAppOpenQRCodeReader
Opens native QR code reader.
This method will prompt a permission request for camera.
Example:
AppBoxoWebAppOpenQRCodeReaderResult or AppBoxoWebAppOpenQRCodeReaderFailed
Example:
Haptic feedback
AppBoxoWebAppVibrate
Triggers haptic engine on the device, if available.
Parameters
styleoptional'light' | 'medium' | 'heavy'Controls strength of vibration, defaults to ‘light’. Example:
Action sheet
AppBoxoWebAppShowActionSheet
Shows native action sheet
Parameters
header optional string Action sheet header text
list required Array<{ id: number, text: string, role?: 'cancel' | 'destructive' | 'selected' }> Define action sheet items
Example:
AppBoxoWebAppActionSheetItemClick
Event that should be subscribed to in order to get action sheet item click
Example:
Geolocation
AppBoxoWebAppGetGeodata
Requests user geodata.
This method will prompt a permission request to access geolocation.
Example:
Map
AppBoxoWebAppChooseLocation
Open full screen map to choose location
This method will prompt a permission request to access geolocation.
Example:
AppBoxoWebAppOpenLocation
Open full screen map to that shows markered location
This method will prompt a permission request to access geolocation.
Example:
Alert
AppBoxoWebAppShowAlert
Show native alert box
Parameters
header optional string Alert header text
message optional string Alert message
buttons required Array<{ id: number, text: string, role?: 'cancel' | 'destructive' }> Define buttons
Example:
Image gallery
AppBoxoWebAppShowImages
Open full screen native image gallery
Parameters
start_index optional number Index to start showing from
images required Array<string> Image urls
Example:
Storage
AppBoxoWebAppStorageGet
Requests a value from the storage
Parameters
keys required Array<string> Keys for getting ([a-zA-Z_-0-9])
Example:
AppBoxoWebAppStorageGetKeys
Request list of keys of some stored values
Parameters
count required number Count of keys to get. Max value is 1000
offset optional number The offset required to fetch a specific subset of keys. Default: 0
Example:
AppBoxoWebAppStorageSet
Stores value in storage
Parameters
key required string The key of value ([a-zA-Z_-0-9])
value optional string value
Example:
AppBoxoWebAppStorageRemove
Removes value in storage
Parameters
key required string The key of value ([a-zA-Z_-0-9])
Example:
AppBoxoWebAppStorageClear
Clears all data in storage
Example:
Clipboard
AppBoxoWebAppGetClipboard
Gets the content on the system clipboard.
Example:
AppBoxoWebAppSetClipboard
Sets the content on the system clipboard.
Parameters
data required string Content to be copied to clipboard
Example:
System information
AppBoxoWebAppGetSystemInfo
Gets system information.
Example:
Accelerometer
AppBoxoWebAppStartAccelerometer
Starts listening on acceleration data.
Example:
AppBoxoWebAppStopAccelerometer
Stops listening on acceleration data.
Example:
AppBoxoWebAppOnAccelerometerChange
Listens on the acceleration data event. You can send AppBoxoWebAppStopAccelerometer event to stop listening.
Example:
Gyroscope
AppBoxoWebAppStartGyroscope
Starts listening on gyroscope data.
Example:
AppBoxoWebAppStopGyroscope
Stops listening on gyroscope data.
Example:
AppBoxoWebAppOnGyroscopeChange
Listens on the gyroscope data event. You can send AppBoxoWebAppStopGyroscope event to stop listening.
Example:
Compass
AppBoxoWebAppStartCompass
Starts listening on compass data.
Example:
AppBoxoWebAppStopCompass
Stops listening on compass data.
Example:
AppBoxoWebAppOnCompassChange
Listens on the compass data event. You can send AppBoxoWebAppStopCompass event to stop listening.
Example:
Background color
AppBoxoWebAppSetBackgroundColor
Dynamically sets the background color of the window.
Status bar color
AppBoxoWebAppSetStatusBarColor
Dynamically sets the status bar color
Tracking
AppBoxoWebAppTrack
Send postback tracking data about transaction
Example:
TIP There is a shortcut that you can use to send tracking data: